package tlias.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import tlias.dto.LogVO;
import tlias.mapper.LogMapper;
import tlias.pojo.*;

import tlias.service.LogService;

@Slf4j
@Service
public class LogServiceImpl implements LogService {
    private final LogMapper logMapper;

    public LogServiceImpl(LogMapper logMapper) {
        this.logMapper = logMapper;
    }

    @Override
    public PageResult<LogVO> page(PageQueryParam param) {
        PageHelper.startPage(param.getPage(), param.getPageSize());
        Page<LogVO> page = (Page<LogVO>) logMapper.page();
        return new PageResult<>(page.getTotal(), page.getResult());
    }
}